home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD School House 10
/
CD School House - Education and Games (10.0) - Wayzata Technology (1995).iso
/
mac
/
DOS
/
MISC
/
FTK
/
LADDER.TK
< prev
next >
Wrap
Text File
|
1994-02-24
|
2KB
|
188 lines
TK!2
=v
#1
:n
h
:v
10
:s
i
:c
Level of the ladders' crossing point
#2
:n
L1
:v
40
:s
i
:c
Length of the 1st ladder
#3
:n
L2
:v
30
:s
i
:c
Length of the 2nd ladder
#4
:n
ya
:s
b
:c
Level of touch point (1st ladder)
#5
:n
yb
:s
b
:c
Level of touch point (2nd ladder)
#6
:n
w
:s
b
:c
Width of the alley
#7
:n
w0
:s
b
:c
Final width vs. first guess ratio
:f
1
#8
:n
hmax
:s
b
:c
Maximum feasible level h
#10
:n
:s
b
:c
|<------ w ------->|
#11
:n
:s
b
:c
ya|\ |
#12
:n
:s
b
:c
| \ |
#13
:n
:s
b
:c
| \ L1 /|yb
#14
:n
:s
b
:c
| \ L2 / |
#15
:n
:s
b
:c
| \ / |
#16
:n
:s
b
:c
| /|\ |
#17
:n
:s
b
:c
| / | \ |
#18
:n
:s
b
:c
| / h| \ |
#19
:n
:s
b
:c
----|/---------|------\|--
=u
=r
#1
:r
" ********** LADDERS IN THE ALLEY **********
:s
C
#2
:r
L1^2 = w^2 + ya^2 " There is an alley bounded by two high buildings.
#3
:r
L2^2 = w^2 + yb^2 " Two ladders, L1 and L2 long, rest in corners and
#4
:r
1/h = 1/ya + 1/yb " lean against opposite buildings. What is w given h ?
#6
:r
" The Iterative Solver has to be used. Guessing the unknown w usually leads
:s
C
#7
:r
" to trouble because the interval of feasible guess values is too narrow.
:s
C
#8
:r
" A reasonable guess depends on the magnitude of L1,L2,h; we may write it as
:s
C
#10
:r
w/w0 = sqrt(min(L1,L2)^2 - (1/(1/h-1/max(L1,L2)))^2)
#12
:r
" and assign w0=1 as the First guess. Now iteration is invoked automatically
:s
C
#13
:r
" and always converges to a correct solution for any feasible L1,L2,h.
:s
C
#15
:r
1/hmax = 1/L1 + 1/L2 " This protects against trying too large a value for h:
#16
:r
h = min(h,hmax) " error in this rule indicates infeasible data.
%Tr,f,0,1,0,1,0